#define _CRT_SECURE_NO_WARNINGS 1
int search(int* nums, int numsSize, int target)
{
	int left = 0;
	int right = numsSize - 1;
	while (left <= right)
	{
		int x = left + (right - left) / 2;
		if (nums[x] == target)
		{
			return x;
		}
		else if(nums[x]>target)
		{
			right = x-1;
		}
		else
		{
			left = x+1;
		}
	}
	return -1;
}